<?php

namespace app\models\role;

use Yii;

/**
 * This is the model class for table "permission".
 *
 * @property int $id
 * @property int $role_id
 * @property int $menu_id
 */
class Permission extends \yii\db\ActiveRecord
{
    /**
     * {@inheritdoc}
     */
    public static function tableName()
    {
        return 'permission';
    }

    /**
     * {@inheritdoc}
     */
    public function rules()
    {
        return [
            [['role_id', 'menu_id'], 'integer'],
        ];
    }

    /**
     * {@inheritdoc}
     */
    public function attributeLabels()
    {
        return [
            'id' => 'ID',
            'role_id' => 'Role ID',
            'menu_id' => 'Menu ID',
            'can_delete' => 'Can Delete',
        ];
    }

    public function getRole()
    {
        return $this->hasOne(Role::class, ['id' => 'role_id']);
    }

    public function getMenu()
    {
        return $this->hasOne(RoleMenu::class, ['id' => 'menu_id']);
    }
}
